﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace Karo
{

    class EngineInterface
    {
        [DllImport("KaroEngine.dll")]
        public static extern int GetSize();

        public const int BOARD_SIZE = 50 * 50;

    
            /// <summary>
            /// This is the struct shared between C# and C++
            /// </summary>
            [StructLayout(LayoutKind.Sequential)]
            public struct BoardInfo
            {
                [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
                public short[] s1;
            }

            /// <summary>
            /// Send a BoardInfo to the Engine and blocks waiting  for a
            /// new BoardInfo in response, containing the computer's move.
            /// </summary>
            [DllImport("KaroEngine.dll")]
            public static extern BoardInfo NewGame();


            public static void CommunicationTest() {

                System.Console.WriteLine("CommunicationTest");

                //BoardInfo newBoard = NewGame();

                //System.Console.WriteLine(newBoard.pawns[0]);

        }
    }


    //How comunication should work:
    //1. Create a BoardInfo containing the info from the current board.
    //2. In another thread, send BoardInfo to engine and wait for it to return the new boardinfo
    //3. Update board with the BoardInfo we received from engine

}

